package com.aabte.commons.ddd.shared;

import java.io.Serializable;

/**
 * An entity, as explained in the DDD book.
 */
public interface DomainEntity<T, ID> extends Serializable {

    /**
     * Entities compare by identity, not by attributes.
     *
     * @param other The other entity.
     * @return true if the identities are the same, regardles of other attributes.
     */
    boolean sameIdentityAs(T other);

    /**
     * Entities have an identity.
     *
     * @return The identity of this entity.
     */
    ID identity();

}
